set the visible of field 1 to false -- background field
set the scroll of card field 1 to 0
set the scroll of card field 2 to 0
set the visible of button "close windows" to false
end opencard
on closecard
set the visible of field 1 to true
end closecard
-- part 5 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=18 top=32 right=290 bottom=384
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 20
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: XCMD Text
-- part 6 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=304 top=299 right=321 bottom=425
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show LSC Source
----- HyperTalk script -----
on mouseUp
get the visible of card field "source"
set the visible of card field "source" to not it
if it is false then
set the name of me to "Hide LSC Source"
else
set the name of me to "Show LSC Source"
end if
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=394 top=38 right=132 bottom=484
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Copy This
----- HyperTalk script -----
on mouseUp
global window1,window2
if window1 is empty then
put "150,140,250,240" into aRect
auxWindow "open","aux 1",aRect
put the result into window1
put the rect of button 2 into aRect
auxWindow "use",window1,arect
if window2 is not empty then
set the visible of card button swap to true
end if
else
put "Its window is already up!"
end if
set the visible of button "close windows" to true
end mouseUp
-- part 10 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=395 top=141 right=240 bottom=485
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: This Too!
----- HyperTalk script -----
on mouseUp
global window2,window1
if window2 is empty then
put "300,140,400,240" into aRect
auxWindow "open","aux 2",aRect
put the result into window2
put the rect of button 3 into aRect
auxWindow "use",window2,arect
if window1 is not empty then
set the visible of card button swap to true
end if
else
put "Its window is already up!"
end if
set the visible of button "close windows" to true
end mouseUp
-- part 11 (button)
-- low flags: 80
-- high flags: 8003
-- rect: left=59 top=299 right=322 bottom=170
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Close Windows
----- HyperTalk script -----
on mouseUp
global window1,window2
if window1 is not empty then
AuxWindow "close",window1
put empty into window1
end if
if window2 is not empty then
AuxWindow "close",window2
put empty into window2
end if
set the visible of me to false
set the visible of button "swap" to false
put empty
end mouseUp
-- part 12 (button)
-- low flags: 80
-- high flags: 8003
-- rect: left=402 top=254 right=275 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Swap
----- HyperTalk script -----
on mouseUp
global window1,window2
if window1 is not empty and window2 is not empty then
auxwindow "use",window1,the rect of button 3
auxwindow "use",window2,the rect of button 2
set the visible of button "swap" to false
else
put "You need both windows up to do this."
end if
end mouseUp
-- part 7 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=18 top=31 right=292 bottom=488
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: source
-- part contents for card part 5
----- text -----
AuxWindow Version 1.0d1
Roger Brown
AuxWindow is an XCMD that lets you create a new window that is relatively smart in the HyperCard environment. This XCMD does not do anything especially useful, but can serve as a shell for more elaborate operations. As presented here, AuxWindow lets you create any number of auxiliary windows. For each, you specify a name and a frame rectangle. The window created is of type rDocProc with no go-away box. This is important, because a window nees to be disposed using the XCMD "close" operation so that the window pointer is properly purged.
An auxiliary window can be dragged around and put in front or behind other windows such as the tools and pattern pallettes, desk accessories, and other auxiliary windows. The card window will always stay behind, of course. HyperCard is very smart about managing windows. An auxiliary window will properly update its contents because they are stored as a WindowPicture. (See the LSC code.) One oddity is that you must click on the title bar to activate one of them. This is HyperCard's doing.
The XCMD as presented here allows you to open a window and later close it. The script must maintain the window pointer in a global. For HyperCard versions later than 1.1 this business could be hidden in a global that never appears in a script.
With this version, you can also use a window to hold a drawing. The code calls back to HyperCard to copy a area of the card's paint layer and installs the copy in the aux window using the clipboard. (See the LSC code.)
To try it, click on the patterns marked "Copy This!" and "This Too!" on the right side of this card. The patterns you click on will appear in auxiliary windows. Then move them around a bit with other windows present to see what happens. Press the "Swap" button to see the pictures interchange. Finally, close the windows with by pressing the "Close" button. Look at the scripts of these buttons to see how to use the XCMD.
INVOKING XScrollBox
AuxWindow "open",name of window, frame rect of window
the result must be held in a global, this is the Window Pointer
AuxWindow "use",window pointer global, rectangle to copy
AuxWindow "close", window pointer
REVISION HISTORY
1.0d1 7/1/88 add name and frame parameters
-- part contents for card part 7
----- text -----
/* AuxWindow1.0d1.c */
/* version 1 add name and location rect in open */